
import {useState} from 'react';
function useService(service){
    let [,forceUpdate] = useState(0);
    return [service.state,(event)=>{
        service.send(event);
        forceUpdate(x=>x+1);//加1是为了让组件渲染
    }];
}

export default useService;
//编译原理中的词法分析用的也是有限状态机